package com.pozu.new_retail.utils;

import java.util.concurrent.ConcurrentHashMap;

/**
 * 缓存管理器
 * @author chao
 * @date 2018年4月20日
 */
public class CacheManager {

	private static ConcurrentHashMap<String, Long> cacheMap = new ConcurrentHashMap<String, Long>();
	
	public static Long getData(String phone) {
		
		if (cacheMap.containsKey(phone)) {
			return cacheMap.get(phone);	
		}
		return null;
		
	}
	
	public static void setData(String phone) {
		cacheMap.put(phone, System.currentTimeMillis());
	}
	
	public static ConcurrentHashMap<String, Long> getAllData(){
		return cacheMap;
	}
	
	public static void clear(String phone) {
		cacheMap.remove(phone);
	}
	
}
